{include file="public/_meta" title="新增栏目"/}
<div class="page-container">
	<form action="" method="post" class="form form-horizontal" id="form-category-add">
		<div id="tab-category" class="HuiTab">
			<div class="tabCon">
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">
						<span class="c-red">*</span>
						上级目录：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<span class="select-box">
						<select class="select" id="pid" name="pid">
							<option value="0">顶级目录</option>
							{volist name="list" id="vo"}
							<option {if condition="$vo['level'] eq 1"} disabled="disabled" {/if} value="{$vo.id}"><?php echo str_repeat('&nbsp;',$vo['level']*6)?>{$vo.list_name}</option>
							{/volist}
						</select>
						</span>
					</div>
					<div class="col-3">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">
						<span class="c-red">*</span>
						目录名称：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="" placeholder="请输入目录名称" id="list_name" name="list_name">
					</div>
					<div class="col-3">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">
						<span class="c-red">*</span>
						模块名称：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="" placeholder="请输入模块名称"  name="module">
					</div>
					<div class="col-3">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">
						<span class="c-red">*</span>
						控制器名称：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="" placeholder="注：控制器请使用驼峰，如：TestType"  name="controller">
					</div>
					<div class="col-3">
					</div>
				</div>
				<div id="function" class="row cl">
					<label class="form-label col-xs-4 col-sm-3">
						<span class="c-red">*</span>
						方法名称：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="" placeholder="请输入方法名称"  name="function">
					</div>
					<div class="col-3">
					</div>
				</div>
				<!--<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">
						<span class="c-red">*</span>
						目录url地址：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" value="" placeholder="请输入二级目录地址如：index/index" id="frame_url" name="frame_url">
					</div>
					<div class="col-3">
					</div>
				</div>-->
				<div id="list_icon" class="row cl">
					<label class="form-label col-xs-4 col-sm-3">目录icon图标：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input style="padding-left:5px;width:200px;border: 1px solid #ddd;height:31px;" type="text" value="" placeholder="请输入icon图标符合" name="list_icon">&nbsp;
						<i id="icon_display" style="padding-right:5px;font-size:31px;" class="Hui-iconfont" title="查看icon"></i><a href="javascript:void(0);" onclick="icon_list('点击选择icon','{:url(\'System/icon\')}','800','300')" class="btn btn-primary size-M radius">点击选择icon</a>
					</div>
					<div class="col-3"></div>
				</div>
				<div id="select_icon"  class="row cl">
					<label class="form-label col-xs-4 col-sm-3">下拉icon图标：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i>
					</div>
					<div class="col-3">
					</div>
				</div>
			</div>
		</div>
		<div class="row cl">
			<div class="col-9 col-offset-3">
				<input class="btn btn-primary size-M radius" type="submit" value="提交">
				<button onClick="parent.layer.close(parent.layer.getFrameIndex(window.name));" class="btn btn-success size-M radius" type="button">取消</button>

			</div>
		</div>
	</form>
</div>

<!--_footer 作为公共模版分离出去-->
{include file="public/_footer" /}
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->

<script type="text/javascript">

	/*icon图标页面*/
    function icon_list(title,url,w,h){
        layer_show(title,url,w,h);
    }

    //选中的值改变时
    $('.select').change(function(){
        //选中的值
        option = $('#pid').val();
        if(option != 0){
            $('#list_icon').remove();
            $('#select_icon').remove();
        }else if(option == 0){
            $('#function').after('<div id="list_icon" class="row cl">' + '<label class="form-label col-xs-4 col-sm-3">目录icon图标：</label>' + '<div class="formControls col-xs-8 col-sm-9">' + '<input style="padding-left:5px;width:200px;border: 1px solid #ddd;height:31px;" type="text" value="" placeholder="请输入icon图标符合" name="list_icon">'+ '&nbsp;'+ '<i id="icon_display" style="padding-right:5px;font-size:31px;" class="Hui-iconfont" title="查看icon"></i><a href="javascript:void(0);" onclick="icon_list(\'点击选择icon\',\'{:url(\'System/icon\')}\',\'800\',\'400\')" class="btn btn-primary size-M radius">点击选择icon</a>' + '</div>' + '<div class="col-3">' + '</div>' + '</div>' + '<div id="select_icon"  class="row cl">' + '<label class="form-label col-xs-4 col-sm-3">下拉icon图标：</label>' + '<div class="formControls col-xs-8 col-sm-9">' + '<i class="Hui-iconfont menu_dropdown-arrow">&#xe6d5;</i>' + '</div>' + '<div class="col-3">' + '</div>' + '</div>');
		}
    });

$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	$("#tab-category").Huitab({
		index:0
	});
	$("#form-category-add").validate({
		rules:{
			
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){

			var data = $(form).serializeArray();
			$(form).ajaxSubmit({
				url : "{:url('system/add_menu_list')}",
				type : 'post',
				dataType : 'json',
				data : data,
				async : false,
				success : function(msg){
					if(msg.status == true){
						layer.msg(msg.message,{icon: 6,time:1000});
						setTimeout(jump,1000);
						function jump(){
							parent.location.reload();
						}
					}else if(msg.status == false){
						layer.msg(msg.message,{icon: 5,time:1000});
					}
				}
			});
		}
	});
});
</script>
<!--/请在上方写此页面业务相关的脚本-->

